echo $env:PROCESSOR_ARCHITECTURE

# Determine processor architecture
$Architecture = $env:PROCESSOR_ARCHITECTURE
if ($Architecture -eq 'AMD64') {
    $InstallerUrl = 'https://aka.ms/vs/17/release/vc_redist.x64.exe'
} elseif ($Architecture -eq 'ARM64') {
    $InstallerUrl = 'https://aka.ms/vs/17/release/vc_redist.arm64.exe'
} else {
    $InstallerUrl = 'https://aka.ms/vs/17/release/vc_redist.x86.exe'
}

echo $InstallerUrl

# Download installer
$InstallerPath = "$env:TEMP\vc_redist.exe"
Invoke-WebRequest -Uri $InstallerUrl -OutFile $InstallerPath

# Install Visual C++ redistributable
Start-Process -FilePath $InstallerPath -ArgumentList '/install', '/passive', '/norestart' -Wait

# Clean up
Remove-Item -Path $InstallerPath